package com.mynotes.notes.adapter;

import java.util.List;

import com.mynotes.notes.R;
import com.mynotes.notes.entity.Group;
import com.mynotes.notes.utils.imageLoader;
import com.nostra13.universalimageloader.core.ImageLoader;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class GridViewAdapter extends BaseAdapter {
	private Context context;
	private LayoutInflater inflater;
	private List<String> paths;
	private ImageLoader loader;

	public GridViewAdapter(Context context, List<String> paths) {
		super();
		this.context = context;
		this.paths = paths;
		inflater = LayoutInflater.from(this.context);
		loader = imageLoader.getLoader(context);
	}

	public int getCount() {
		return paths.size();
	}

	@Override
	public Object getItem(int arg0) {
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		return 0;
	}

	@Override
	public View getView(int position, View view, ViewGroup arg2) {
		View v = null;
		if (view == null) {
			v = inflater.inflate(R.layout.grid_item2, null);
		} else {
			v = view;
		}
		ImageView img = (ImageView) v.findViewById(R.id.group_img);
		loader.displayImage(paths.get(position), img, imageLoader.options);
		return null;
	}

}
